using System;
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;

namespace RaisingStudio.SmallBasicCompiler
{
	public class CodeGenScope
	{
		public TypeBuilder TypeBuilder
		{
			get;
			set;
		}
		public MethodBuilder MethodBuilder
		{
			get;
			set;
		}

        public SymbolTable SymbolTable
		{
			get;
			set;
		}
		public TypeInfoBag TypeInfoBag
		{
			get;
			set;
		}

		public ILGenerator ILGenerator
		{
			get;
			set;
		}

		private CodeGenScope _parent;
		public CodeGenScope Parent
		{
			get
			{
				return this._parent;
			}
			set
			{
				this._parent = value;
				this._fields = value.Fields;
				this._labels = value.Labels;
				this._methodBuilders = value.MethodBuilders;
				this.SymbolTable = value.SymbolTable;
				this.TypeInfoBag = value.TypeInfoBag;
			}
		}

		private Dictionary<string, FieldInfo> _fields;
		public Dictionary<string, FieldInfo> Fields
		{
			get
			{
				if (this._fields == null)
				{
					this._fields = new Dictionary<string, FieldInfo>();
				}
				return this._fields;
			}
		}

		private Dictionary<string, MethodBuilder> _methodBuilders;
		public Dictionary<string, MethodBuilder> MethodBuilders
		{
			get
			{
				if (this._methodBuilders == null)
				{
					this._methodBuilders = new Dictionary<string, MethodBuilder>();
				}
				return this._methodBuilders;
			}
		}

		private Dictionary<string, Label> _labels;
		public Dictionary<string, Label> Labels
		{
			get
			{
				if (this._labels == null)
				{
					this._labels = new Dictionary<string, Label>();
				}
				return this._labels;
			}
		}
	}
}
